<!--Descriptive page name, messages and instructions--><h2><%= t('.find_users', :default => "Find users:") %></h2>
<!--/descriptions-->

<!--subnav-->
<!--/subnav-->

<!--main content-->
<%= form_tag url_for(:controller => "admin/admin_users", :action => "index"), :method => :get do %>
    <p><%= t('.search_by', :default => 'Search for a user by username, pseud or email, or search by role') %></p>
<dl>
    <dt><%= label_tag "query", t("user_find_query", :default => "Name or email") %></dt>
      <dd><%= text_field_tag "query", params[:query] %></dd>
    <dt><%= label_tag "role", t("user_find_role", :default => "Role") %></dt>
      <dd><%= select_tag "role", "<option id='0' name='regular' value='0'>Regular User</option><option id='1' name='unvalidated' value='1'>Unvalidated</option>".html_safe + options_for_select(Role.all.collect(&:name).uniq.map{|role_name| [role_name.humanize.titlecase, role_name]}, params[:role] ? params[:role] : nil) %></dd>
  </dl>
  <p class="submit"><%= submit_tag t("find_user_button", :default => "Find") %></p>
<% end %>
<div class="clear"><!--presentational, phase me out--></div>
<% if @users %>

<h3><%= @users.size == 1 ? "1 user found" : @users.size == 0 ? "No users found" : @users.size.to_s + " users found" %></h3>

<% if @users.size > 0 %>
  <div class="wrapper">
	<table id="admin_users_table">
  <caption><%=h t('.list', :default => "List of users") %></caption>
  <colgroup>
	<col class="name"/>
	<col span="6" />
	</colgroup>
	<thead>
		<tr>
    		<th scope="col"><%=h t('.username', :default => "Username") %></th>
    		<th scope="col"><%=h t('.email', :default => "Email") %></th>
    		<th scope="col"><%=h t('.translation_admin', :default => "Translation Admin") %></th>
    		<th scope="col"><%=h t('.tag_wrangler', :default => "Tag Wrangler") %></th>
    		<th scope="col"><%=h t('.archivist', :default => "Archivist") %></th>
    		<th scope="col"><%=h t('.update', :default => "Update") %></th>
    		<th scope="col"><%=h t('.details', :default => "Details") %></th>
  		</tr>
	</thead>
	<tbody>
    <% @users.each do |user| %>
    	<tr id="user_<%= user.id %>">
      		<%= render :partial => 'user_form', :locals => {:user => user} %>
    	</tr> 
  <% end %>
	</tbody>
<% end %>
  </table>
</div>
<% end %>
<!--/content-->
